package com.web.exiaodao.business.entity;

import com.web.webstart.base.entity.BaseEntity;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author eason
 * @ClassName: category
 * @Description: 分类表定义表
 * @date 2016-11-29 12:09:17
 */
@Entity
//@Table(name = "tb_xa_shopcategory")
@Table(name = "tb_xa_category")
@ApiModel(value = "分类表定义表；1：商品 ：2：资讯")
public class Category extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "分类名称,分类名称")
    private String categoryName;
    @ApiModelProperty(value = "商品分类图标,商品分类图标")
    private String categoryIcon;
    @ApiModelProperty(value = "商品分类图标-选中状态,商品分类图标-选中状态")
    private String categorySelectIcon;
    @ApiModelProperty(value = "分类排序值,分类排序值")
    private Integer categoryOrder;
    @ApiModelProperty(value = "类别模块;1：商品 ：2：资讯")
    private Integer type;

    public static final int DEFAULT_TYPE = 1;


    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    @Column(nullable = true, length = 50)
    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryIcon(String categoryIcon) {
        this.categoryIcon = categoryIcon;
    }

    @Column(nullable = true, length = 255)
    public String getCategoryIcon() {
        return categoryIcon;
    }

    public void setCategoryOrder(Integer categoryOrder) {
        this.categoryOrder = categoryOrder;
    }

    @Column(nullable = true, length = 255)
    public String getCategorySelectIcon() {
        return categorySelectIcon;
    }

    public void setCategorySelectIcon(String categorySelectIcon) {
        this.categorySelectIcon = categorySelectIcon;
    }

    @Column(nullable = true, length = 50)
    public Integer getCategoryOrder() {
        return categoryOrder;
    }

    @Column(nullable = true, length = 50)
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    @Override
    public void setInsertBefore() {
        super.setInsertBefore();
        if (type == null || type == 0) {
            type = DEFAULT_TYPE;
        }
    }
}
